<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">




<title>Spring.NET学习笔记15——AOP的配置(基础篇) Level 200 - 刘冬的备忘录 - 博客园</title>
<meta name="keywords" content="Spring.NET,AOP">



<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/GoodHelper/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/GoodHelper/rsd.xml"> 
  



<link rel="stylesheet" type="text/css" href="index.css" media="all">
</head>
<body><div style="border: 1px solid rgb(126, 152, 214); margin: 0px; padding: 1px; position: absolute; background-color: rgb(231, 247, 247); font-size: 14px; left: 3px; top: 3px; width: 138px; height: 22px; text-align: center; z-index: 99; display: none;" id="_dict_status"></div><div style="margin: 0px; padding: 0px; position: absolute; display: none; width: 240px; z-index: 98; background-color: rgb(255, 255, 255);" id="_dict_layer"><table style="border: 1px solid rgb(126, 152, 214);" border="0" cellpadding="0" cellspacing="0" width="240"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;" width="100%"><div style="border: medium none ; margin: 0px; padding: 0px; width: 240px; height: 20px; cursor: move; background-color: rgb(200, 218, 243); display: inline;"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0pt 3px; background-color: rgb(200, 218, 243); color: rgb(26, 145, 0); font-size: 14px; line-height: 20px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_title" name="_dict_title" align="left" height="20" width="60%">划词翻译 - Dict.CN</td><td style="border: medium none ; margin: 0px; padding: 0pt 3px; background-color: rgb(200, 218, 243); line-height: 20px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" align="right" height="20" valign="middle"><a href="http://dict.cn/scb/" target="_top" title="生词本" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_add" name="_dict_add"><img src="add.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="http://dict.cn/" target="_top" title="详细解释" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_detail" name="_dict_detail"><img src="detail.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="http://dict.cn/foot/help.htm" target="_top" title="帮助" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><img src="help.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="javascript:_dictClose()" title="关闭" target="_self" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><img src="close.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a></td></tr></tbody></table></div><table style="border: medium none ; margin: 0px; padding: 0px;" align="center" border="0" cellpadding="3" cellspacing="4" width="100%"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;"><fieldset color="#00c0ff" style="margin: 0px; padding: 0pt 2px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><legend align="center" style="margin: 0px; padding: 0px;"><a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px;"><img src="qdict.gif" border="0" height="53" width="126"></a></legend><table style="border: medium none ; margin: 0px; padding: 0px;" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;" id="_dictContent" name="_dictContent" height="120" width="100%"><iframe id="_dictFrame" name="_dictFrame" src="index_1.html" frameborder="0" height="120" width="100%"></iframe></td></tr><tr align="center"><td style="border: medium none ; margin: 0px; padding: 0px; color: rgb(153, 153, 153); font-size: 10px; line-height: 18px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" height="18" valign="bottom" width="100%">©2003-2008 <a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px; color: rgb(46, 168, 237); font-size: 10px; line-height: 18px; text-decoration: none; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;">Dict.CN</a> <a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px; color: rgb(153, 153, 153); font-size: 10px; line-height: 18px; text-decoration: none; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;">海词</a></td></tr></tbody></table></fieldset></td></tr></tbody></table></td></tr></tbody></table></div>
    <form name="Form1" method="post" action="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html" id="Form1">
<div>
<input name="__EVENTTARGET" id="__EVENTTARGET" value="" type="hidden">
<input name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" type="hidden">
<input name="__VIEWSTATE" id="__VIEWSTATE" value="" type="hidden">
</div>




        
<!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
	<a id="lnkBlogLogo" href="http://www.cnblogs.com/GoodHelper/"><img id="blogLogo" src="logo.gif" alt="返回主页"></a>			
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/GoodHelper/">刘冬的备忘录</a></h1>
<h2>打造新疆第一敏捷团队</h2>



		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<!--done-->
			<ul id="navList">
				<li><a id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</a></li>
				<li><a id="MyLinks1_SpaceLink" class="menu" href="http://space.cnblogs.com/">社区</a></li>
				<li><a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/GoodHelper/">首页</a></li>
				<li><a id="MyLinks1_NewPostLink" class="menu" href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx?opt=1">新随笔</a></li>
				<li><a id="MyLinks1_ContactLink" accesskey="9" class="menu" href="http://space.cnblogs.com/msg/send/%e5%88%98%e5%86%ac.NET">联系</a></li>
				<li><a id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx">管理</a></li>
				<li><a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/GoodHelper/rss">订阅</a>
				<a id="MyLinks1_XMLLink" class="aHeaderXML" href="http://www.cnblogs.com/GoodHelper/rss"><img src="rss.gif" alt="订阅" style="border-width: 0px;"></a></li>
			</ul>


		<div class="blogStats">
			
			
<!--done-->
随笔- 32&nbsp;
文章- 2&nbsp;
评论- 226&nbsp;

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->

<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		
					
<!--done-->
<div id="topics">
	<div class="post">
		<h1 class="postTitle">
			<a id="ctl04_TitleUrl" class="postTitle2" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html">Spring.NET学习笔记15——AOP的配置(基础篇) Level 200</a>
		</h1>
		<div class="clear"></div>
		<div class="postBody">
			<p>　　上篇我学习了<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>的四种<strong>通知</strong>类型，<strong><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top"><strong>AOP</strong></a></strong>的实现方案比较复杂，是通过代码实现的。而<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>框架给我们提供了配置的方式来实现<strong><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top"><strong>AOP</strong></a></strong>的功能。到目前为止，我们已经讨论过使用<span style="color: rgb(51, 102, 255);">ProxyFactoryObject</span>或其它类似的工厂对象显式创建<strong><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top"><strong>AOP</strong></a></strong>代理的方法。如果应用程序需要创建很多<strong><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top"><strong>AOP</strong></a></strong>代理，比如当需要代理某个服务层的所有对象时，这种方法就会使配置文件变的相当庞大。为简化配置过程，<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>提供了“<strong>自动代理</strong>”的功能，可以根据条件自动创建<strong>代理对象</strong>，也就是说，可以将多个对象分组以作为要代理的候选对象。<strong>自动代理</strong>使用起来比较简单和方便。我仔细分析了一下，提供的几种配置差异主要在于<strong>切入点</strong>的方式不同。目前我实现了三种<strong>切入点</strong>的配置方式。</p>
<p>　　首先我们先来看一下准备环境。　　</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_010300" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_010300').style.display='none'; document.getElementById('Code_Open_Image_010300').style.display='inline'; document.getElementById('Code_Open_Text_010300').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_010300" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_010300').style.display='none'; getElementById('Code_Closed_Image_010300').style.display='inline'; getElementById('Code_Closed_Text_010300').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_010300">通知</span><span id="Code_Open_Text_010300" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="none.gif" align="top"><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;AroundAdvice&nbsp;:&nbsp;IMethodInterceptor<br><img id="Codehighlighter1_55_418_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_55_418_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_55_418_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_55_418_Closed_Text').style.display='inline';" src="expandedblockstart.gif" align="top"><img id="Codehighlighter1_55_418_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_55_418_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_55_418_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_55_418_Open_Text').style.display='inline';" src="contractedblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_55_418_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_55_418_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Invoke(IMethodInvocation&nbsp;invocation)<br><img id="Codehighlighter1_124_412_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_124_412_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_124_412_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_124_412_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_124_412_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_124_412_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_124_412_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_124_412_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_124_412_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_124_412_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">开始:&nbsp;&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;invocation.TargetType.Name&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;invocation.Method.Name);<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;result&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;invocation.Proceed();<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">结束:&nbsp;&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;invocation.TargetType.Name&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;invocation.Method.Name);<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;result;<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="expandedblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div>
<p>　　</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_010407" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_010407').style.display='none'; document.getElementById('Code_Open_Image_010407').style.display='inline'; document.getElementById('Code_Open_Text_010407').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_010407" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_010407').style.display='none'; getElementById('Code_Closed_Image_010407').style.display='inline'; getElementById('Code_Closed_Text_010407').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_010407">目标对象</span><span id="Code_Open_Text_010407" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="none.gif" align="top"><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">interface</span><span style="color: rgb(0, 0, 0);">&nbsp;IService<br><img id="Codehighlighter1_34_101_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_34_101_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_34_101_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_34_101_Closed_Text').style.display='inline';" src="expandedblockstart.gif" align="top"><img id="Codehighlighter1_34_101_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_34_101_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_34_101_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_34_101_Open_Text').style.display='inline';" src="contractedblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_34_101_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_34_101_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IList&nbsp;FindAll();<br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;entity);<br><img alt="" src="expandedblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="none.gif" align="top"><br><img alt="" src="none.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;CategoryService&nbsp;:&nbsp;IService<br><img id="Codehighlighter1_151_353_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_151_353_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_151_353_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_151_353_Closed_Text').style.display='inline';" src="expandedblockstart.gif" align="top"><img id="Codehighlighter1_151_353_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_151_353_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_151_353_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_151_353_Open_Text').style.display='inline';" src="contractedblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_151_353_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_151_353_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;IList&nbsp;FindAll()<br><img id="Codehighlighter1_192_239_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_192_239_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_192_239_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_192_239_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_192_239_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_192_239_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_192_239_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_192_239_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_192_239_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_192_239_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArrayList();<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;entity)<br><img id="Codehighlighter1_289_347_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_289_347_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_289_347_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_289_347_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_289_347_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_289_347_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_289_347_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_289_347_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_289_347_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_289_347_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">保存：</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;entity);<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="expandedblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="none.gif" align="top"><br><img alt="" src="none.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;ProductService&nbsp;:&nbsp;IService<br><img id="Codehighlighter1_402_604_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_402_604_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_402_604_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_402_604_Closed_Text').style.display='inline';" src="expandedblockstart.gif" align="top"><img id="Codehighlighter1_402_604_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_402_604_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_402_604_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_402_604_Open_Text').style.display='inline';" src="contractedblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_402_604_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_402_604_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;IList&nbsp;FindAll()<br><img id="Codehighlighter1_443_490_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_443_490_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_443_490_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_443_490_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_443_490_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_443_490_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_443_490_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_443_490_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_443_490_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_443_490_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArrayList();<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;entity)<br><img id="Codehighlighter1_540_598_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_540_598_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_540_598_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_540_598_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_540_598_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_540_598_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_540_598_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_540_598_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_540_598_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_540_598_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">保存：</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;entity);<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="expandedblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div>
<p>&nbsp;</p>
<p>　　<strong>一、对象名称切入点</strong>：<span style="color: rgb(51, 102, 255);">ObjectNameAutoProxyCreator　　</span></p>
<p>　　<span style="color: rgb(51, 102, 255);">ObjectNameAutoProxyCreator</span><span style="color: rgb(0, 0, 0);">可</span><span style="color: rgb(0, 0, 0);">以</span>用特定的文本值或通配符匹配目标对象的名称，并为满足条件的目标对象创建<strong><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top"><strong>AOP</strong></a></strong>代理。该类支持模式匹配字符串，如：<span style="color: rgb(0, 0, 255);">"*name"</span>，"<span style="color: rgb(0, 0, 255);">name</span><span style="color: rgb(0, 0, 255);">*</span><span style="color: rgb(0, 0, 255);">"，”*</span><span style="color: rgb(0, 0, 255);">n</span><span style="color: rgb(0, 0, 255);">ame*</span><span style="color: rgb(0, 0, 0);">“</span>和精确文本如<span style="color: rgb(0, 0, 255);">"</span><span style="color: rgb(0, 0, 255);">name"</span><span style="color: rgb(0, 0, 0);">。</span>我们可以通过下面这个简单的例子了解一下<strong>自动代理</strong>的功能。 </p>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_011347" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_011347').style.display='none'; document.getElementById('Code_Open_Image_011347').style.display='inline'; document.getElementById('Code_Open_Text_011347').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_011347" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_011347').style.display='none'; getElementById('Code_Closed_Image_011347').style.display='inline'; getElementById('Code_Closed_Text_011347').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_011347">App.config</span><span id="Code_Open_Text_011347" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="ProxyCreator"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ObjectNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">*Service</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="InterceptorNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">aroundAdvice</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Common.AroundAdvice,&nbsp;Common"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="categoryService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="productService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></span></div>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_011438" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_011438').style.display='none'; document.getElementById('Code_Open_Image_011438').style.display='inline'; document.getElementById('Code_Open_Text_011438').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_011438" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_011438').style.display='none'; getElementById('Code_Closed_Image_011438').style.display='inline'; getElementById('Code_Closed_Text_011438').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_011438">Program</span><span id="Code_Open_Text_011438" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="none.gif" align="top"><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;Program<br><img id="Codehighlighter1_18_671_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_18_671_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_18_671_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_18_671_Closed_Text').style.display='inline';" src="expandedblockstart.gif" align="top"><img id="Codehighlighter1_18_671_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_18_671_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_18_671_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_18_671_Open_Text').style.display='inline';" src="contractedblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_18_671_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_18_671_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Main(</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">[]&nbsp;args)<br><img id="Codehighlighter1_68_665_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_68_665_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_68_665_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_68_665_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_68_665_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_68_665_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_68_665_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_68_665_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_68_665_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_68_665_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IApplicationContext&nbsp;ctx&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ContextRegistry.GetContext();<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IDictionary&nbsp;speakerDictionary&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ctx.GetObjectsOfType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(IService));<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">&nbsp;(DictionaryEntry&nbsp;entry&nbsp;</span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);">&nbsp;speakerDictionary)<br><img id="Codehighlighter1_299_621_Open_Image" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_299_621_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_299_621_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_299_621_Closed_Text').style.display='inline';" src="expandedsubblockstart.gif" align="top"><img id="Codehighlighter1_299_621_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_299_621_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_299_621_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_299_621_Open_Text').style.display='inline';" src="contractedsubblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_299_621_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img alt="" src="dot.gif"></span><span id="Codehighlighter1_299_621_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">&nbsp;name&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">)entry.Key;<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IService&nbsp;service&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(IService)entry.Value;<br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(name&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">&nbsp;拦截：&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.FindAll();<br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine();<br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service.Save(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">数据</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine();<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top"><br><img alt="" src="inblock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.ReadLine();<br><img alt="" src="expandedsubblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img alt="" src="expandedblockend.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div>
<p>&nbsp;</p>
<p>　　输出效果：图1<br><img alt="" src="2009-11-1.01.gif" border="0" height="310" width="280">图1</p>
<p>&nbsp;</p>
<p>　　使用<span style="color: rgb(51, 102, 255);">ObjectNameAutoProxyCreator</span>经常需要对要拦截的方法进行筛选，这时我用到<span style="color: rgb(51, 102, 255);">Spring.Aop.Support.NameMatchMethodPointcutAdvisor</span>，稍微修改一下配置：</p>
<div class="cnblogs_code"><img id="Code_Closed_Image_012125" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_012125').style.display='none'; document.getElementById('Code_Open_Image_012125').style.display='inline'; document.getElementById('Code_Open_Text_012125').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_012125" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_012125').style.display='none'; getElementById('Code_Closed_Image_012125').style.display='inline'; getElementById('Code_Closed_Text_012125').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span class="cnblogs_code_Collapse" id="Code_Closed_Text_012125">App.config</span><span id="Code_Open_Text_012125" style="display: none;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="ProxyCreator"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ObjectNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">*Service</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="InterceptorNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">aroundAdvisor</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvisor"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Support.NameMatchMethodPointcutAdvisor,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Advice"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="MappedNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Find*</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Common.AroundAdvice,&nbsp;Common"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></span></div>
<p><br>　　输出效果：图2<br><img alt="" src="2009-11-16.01.gif" border="0" height="227" width="258">图2<br></p>
<p>　　<span style="color: rgb(255, 0, 0);">MappedNames</span>的配置为：<span style="color: rgb(0, 0, 255);">Find*</span>，因此能够拦截到<span style="color: rgb(0, 0, 255);">FindAll</span>方法。<br><br>　　<strong>二、正则表达式切入点</strong>：<span style="color: rgb(51, 102, 255);">RegularExpressionMethodPointcutAdvisor</span>和<span style="color: rgb(0, 128, 128);">SdkRegularExpressionMethodPointcut</span><br>　　<span style="color: rgb(51, 102, 255);">DefaultAdvisorAutoProxyCreator</span>类会在当前容器中自动应用满足条件的<strong>Advisor</strong>，而不用在自动代理<strong>Advisor</strong>的对象定义中包含特定的对象名。它既可以保持配置文件的一致性，又可避免<span style="color: rgb(51, 102, 255);">ObjectNameAutoProxyCreator</span>引起的配置文件的臃肿。</p>
<p>　　先来说<span style="color: rgb(51, 102, 255);">RegularExpressionMethodPointcutAdvisor。</span><br></p>
<div class="cnblogs_code"><img id="Code_Closed_Image_013507" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013507').style.display='none'; document.getElementById('Code_Open_Image_013507').style.display='inline'; document.getElementById('Code_Open_Text_013507').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_013507" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013507').style.display='none'; getElementById('Code_Closed_Image_013507').style.display='inline'; getElementById('Code_Closed_Text_013507').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span class="cnblogs_code_Collapse" id="Code_Closed_Text_013507">App.config</span><span id="Code_Open_Text_013507" style="display: none;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvisor"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Support.RegularExpressionMethodPointcutAdvisor,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="advice"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="patterns"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">.*Find*.*</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">必须让Spring.NET容器管理DefaultAdvisorAutoProxyCreator类</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="ProxyCreator"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Common.AroundAdvice,&nbsp;Common"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="categoryService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="productService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></span></div>
<p>&nbsp;</p>
<p>输出效果：图3<br><img alt="" src="2009-11-16.02.gif" border="0" height="234" width="305">图3<br></p>
<p>　　以上配置相对复杂一点。使用<span style="color: rgb(51, 102, 255);">SdkRegularExpressionMethodPointcut</span>的配置就相对简单的多，而项目中<span style="color: rgb(51, 102, 255);">S</span><span style="color: rgb(51, 102, 255);">dkRegularExpressionMethodPointcut</span><span style="color: rgb(0, 0, 0);">也经常用到</span><span style="color: rgb(0, 0, 0);">。</span><br>　　<span style="color: rgb(51, 102, 255);">SdkRegularExpressionMethodPointcut</span>只需要简单的配置一下通知和切入点就完成了。<br></p>
<div class="cnblogs_code"><img id="Code_Closed_Image_014030" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_014030').style.display='none'; document.getElementById('Code_Open_Image_014030').style.display='inline'; document.getElementById('Code_Open_Text_014030').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_014030" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_014030').style.display='none'; getElementById('Code_Closed_Image_014030').style.display='inline'; getElementById('Code_Closed_Text_014030').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span class="cnblogs_code_Collapse" id="Code_Closed_Text_014030">App.config</span><span id="Code_Open_Text_014030" style="display: none;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="advisor"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Support.SdkRegularExpressionMethodPointcut,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="pattern"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="Service.*"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">aop:config</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">aop:advisor&nbsp;</span><span style="color: rgb(255, 0, 0);">pointcut-ref</span><span style="color: rgb(0, 0, 255);">="advisor"</span><span style="color: rgb(255, 0, 0);">&nbsp;advice-ref</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">aop:config</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Common.AroundAdvice,&nbsp;Common"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="categoryService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="productService"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Service.ProductService,&nbsp;Service"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br></span></span></div>
<p>&nbsp;</p>
<p>输出效果：图4</p>
<p><img alt="" src="2009-11-16.03.gif" border="0">图4<br></p>
<p>&nbsp;</p>
<p>　　<span style="color: rgb(255, 0, 0);">pattern</span>属性为拦截表达式。<span style="color: rgb(0, 0, 255);">Service.*</span>的意思是，拦截<span style="color: rgb(0, 0, 255);">Service</span>命名空间下(包括子空间)的所有类。如果改为<span style="color: rgb(0, 0, 255);">Service.*.Find*"</span>，意思为拦截<span style="color: rgb(0, 0, 255);">Service</span>命名空间下(包括子空间)的所有类以<span style="color: rgb(0, 0, 255);">Find</span>开头的方法或<span style="color: rgb(0, 0, 255);">Service</span>命名空间下以<span style="color: rgb(0, 0, 255);">Find</span>开头的所有类<br>输出效果：图5</p>
<p><img alt="" src="2009-11-16.04.gif" border="0" height="225" width="261">图5</p>
<p>&nbsp;</p>
<p>　　<strong>三、属性切入点</strong>：<span style="color: rgb(51, 102, 255);">AttributeMatchMethodPointcutAdvisor</span><br><a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>框架运行开发人员自定义属性，拦截标注带有特定属性的类中的方法。<br></p>
<div class="cnblogs_code"><img id="Code_Closed_Image_015318" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_015318').style.display='none'; document.getElementById('Code_Open_Image_015318').style.display='inline'; document.getElementById('Code_Open_Text_015318').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_015318" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_015318').style.display='none'; getElementById('Code_Closed_Image_015318').style.display='inline'; getElementById('Code_Closed_Text_015318').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span class="cnblogs_code_Collapse" id="Code_Closed_Text_015318">Attribute</span><span id="Code_Open_Text_015318" style="display: none;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;ConsoleDebugAttribute&nbsp;:&nbsp;Attribute<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;AttributeService&nbsp;:&nbsp;IService<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ConsoleDebug]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;IList&nbsp;FindAll()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArrayList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">保存：</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p>&nbsp;</p>
<div class="cnblogs_code"><img id="Code_Closed_Image_015351" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_015351').style.display='none'; document.getElementById('Code_Open_Image_015351').style.display='inline'; document.getElementById('Code_Open_Text_015351').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_015351" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_015351').style.display='none'; getElementById('Code_Closed_Image_015351').style.display='inline'; getElementById('Code_Closed_Text_015351').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span class="cnblogs_code_Collapse" id="Code_Closed_Text_015351">App.config</span><span id="Code_Open_Text_015351" style="display: none;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvisor"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor,&nbsp;Spring.Aop"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Advice"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Attribute"</span><span style="color: rgb(255, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value</span><span style="color: rgb(0, 0, 255);">="ConfigAttribute.Attributes.ConsoleDebugAttribute,&nbsp;ConfigAttribute"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="proxyFactoryObject"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Aop.Framework.ProxyFactoryObject"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Target"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="ConfigAttribute.Service.AttributeService,&nbsp;ConfigAttribute"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="InterceptorNames"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">aroundAdvisor</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="aroundAdvice"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Common.AroundAdvice,&nbsp;Common"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></span></div>
<p>&nbsp;</p>
<p>　　输出效果：图6<br><img alt="" src="2009-11-16.06.gif" border="0">图6<br></p>
<p>&nbsp;</p>
<p>　　<a style="color: rgb(128, 128, 0);" href="http://files.cnblogs.com/GoodHelper/SpringNet_Lesson15.rar" target="_top">代码下载</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>　　<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_Index.html" target="_top">返回目录</a></p>
<p>&nbsp;</p><div id="EntryTag">Tag标签: <a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/">Spring.NET</a>,<a href="http://www.cnblogs.com/GoodHelper/tag/AOP/">AOP</a></div>
<div id="digg_block">
<div id="div_digg">										
	<div class="diggit" onclick="DiggIt(1603591,58949,1)"> 
		<span class="diggnum" id="digg_count_1603591">1</span>
	</div>
	<div class="buryit" onclick="DiggIt(1603591,58949,2)"> 
		<span class="burynum" id="bury_count_1603591">0</span>
	</div>
	<div class="clear"></div>
	<span style="display: none;" id="span_isdigged_1603591">0</span>	
	<div class="diggword" id="digg_word_1603591">(请您对文章做出评价)</div>	
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev">
<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/13/SpringNet_Aop_Advice.html">« </a> 上一篇：<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/13/SpringNet_Aop_Advice.html" title="发布于2009-11-13 03:50">Spring.NET学习笔记14——AOP的通知类型(基础篇) Level 300</a><br>
<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html">» </a> 下一篇：<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html" title="发布于2009-11-16 20:59">Spring.NET学习笔记16——事务管理(应用篇) Level 200</a><br>
</div>








		</div>
		<div class="postDesc">posted @ 2009-11-16 02:26 <a href="http://www.cnblogs.com/GoodHelper/">刘冬.NET</a> 阅读(1447) <a href="#commentform">评论(10)</a> &nbsp;<a href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx?postid=1603591">编辑</a> <a href="http://www.cnblogs.com/GoodHelper/AddToFavorite.aspx?id=1603591">收藏</a> <a href="#" onclick="PutInWz();return false;">网摘</a>  所属分类: <a href="http://www.cnblogs.com/GoodHelper/category/215413.html">Spring.NET</a></div>
	</div>
	<img src="1603591.html" height="1" width="1">
	
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html"
dc:identifier="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/GoodHelper/services/trackbacks/1603591.aspx" />
</rdf:RDF>
-->

</div><!--end: topics 文章、评论容器-->
<a name="pagedcomment"></a>
<!--done-->
<br>
<div class="feedback_area_title">发表评论</div>
<div class="feedbackNoItems"><span id="span_comment_maxid" style="display: none;">1731282</span></div>
	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("kivenhou",1698932,"AdNm5XywLGy7YYrR8muB7mbndwQKS822SVXatXVj/Chr+oTTPSi8Fg==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1698932,"AdNm5XywLGy7YYrR8muB7mbndwQKS822SVXatXVj/Chr+oTTPSi8Fg==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=kivenhou" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl00$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1698932">#1楼</a><a name="1698932" id="comment_anchor_1698932"></a>2009-11-16 08:04 | <a id="Comments1_CommentList_ctl00_NameLink" href="http://www.cnblogs.com/kivenhou/" target="_top">kivenhou</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/kivenhou" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1698932" class="blog_comment_body">持续关注中，多谢博主分享！</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("lumnm",1698951,"+Fumzc/QAIJ+yYf/C2cxk3eMi1lpp9xLEpjc9/HKo7v9eDXzk8XPwQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1698951,"+Fumzc/QAIJ+yYf/C2cxk3eMi1lpp9xLEpjc9/HKo7v9eDXzk8XPwQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=lumnm" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl01$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1698951">#2楼</a><a name="1698951" id="comment_anchor_1698951"></a>2009-11-16 08:43 | <a id="Comments1_CommentList_ctl01_NameLink" href="http://www.cnblogs.com/lumnm/" target="_top">lumnm</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/lumnm" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1698951" class="blog_comment_body">感觉有些东西学起来有些吃力了</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("Beggar",1698976,"6BqjqsDsgt4Wh75kR0n8051oRQ8Oq/qVdM0MUdhxuffZuXeMkv8ufQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1698976,"6BqjqsDsgt4Wh75kR0n8051oRQ8Oq/qVdM0MUdhxuffZuXeMkv8ufQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Beggar" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl02$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1698976">#3楼</a><a name="1698976" id="comment_anchor_1698976"></a>2009-11-16 09:03 | <a id="Comments1_CommentList_ctl02_NameLink" href="http://www.cnblogs.com/dsktt/" target="_top">Beggar</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/Beggar" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1698976" class="blog_comment_body">支持。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("WideWeide",1729874,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1729874,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=WideWeide" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl03$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1729874">#4楼</a><a name="1729874" id="comment_anchor_1729874"></a>2009-12-21 17:12 | <a id="Comments1_CommentList_ctl03_NameLink" href="http://www.cnblogs.com/WideWeide/" target="_top">WideWeide</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/WideWeide" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1729874" class="blog_comment_body">对SdkRegularExpressionMethodPointcut不太熟。<br><br>我在楼主代码中的ConfigRegular项目中，新添加了一个自定义类：<br><br><div class="syntaxhighlighter  csharp" id="highlighter_37290"><div class="bar"><div class="toolbar"><a class="item viewSource" style="width: 16px; height: 16px;" title="view source" href="#viewSource">view source</a><div class="item copyToClipboard"><embed id="highlighter_37290_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_37290" menu="false" src="clipboard.swf" height="16" width="16"></div><a class="item printSource" style="width: 16px; height: 16px;" title="print" href="#printSource">print</a><a class="item about" style="width: 16px; height: 16px;" title="?" href="#about">?</a></div></div><div class="lines"><div class="line alt1"><table><tbody><tr><td class="number"><code>01</code></td><td class="content"><code class="csharp keyword">using</code> <code class="csharp plain">System;</code></td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>02</code></td><td class="content"><code class="csharp keyword">using</code> <code class="csharp plain">Service;</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>03</code></td><td class="content">&nbsp;</td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>04</code></td><td class="content"><code class="csharp keyword">namespace</code> <code class="csharp plain">ConfigRegular</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>05</code></td><td class="content"><code class="csharp plain">{</code></td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>06</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">class</code> <code class="csharp plain">TestService : ProductService</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>07</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>08</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">public</code> <code class="csharp keyword">void</code> <code class="csharp plain">SayHello()</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>09</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>10</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">Console.WriteLine(</code><code class="csharp string">"Hello"</code><code class="csharp plain">);</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>11</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></td></tr></tbody></table></div><div class="line alt2"><table><tbody><tr><td class="number"><code>12</code></td><td class="content"><code class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></td></tr></tbody></table></div><div class="line alt1"><table><tbody><tr><td class="number"><code>13</code></td><td class="content"><code class="csharp plain">}</code></td></tr></tbody></table></div></div></div><br><br>同时在配置文件中添加：<br>&lt;object id="testService" type="ConfigRegular.TestService,ConfigRegular"/&gt;<br>=======================<br>我的问题是为什么TestService类也被拦截了？<br>因为其继承自Service.ProductService？<br><br>第二个让我比较困扰的问题，如何在使用spring.net的情况下调用SayHello方法？<br>初步想到的办法是，TestService实现一个接口interface ISayHello {void SayHello();}<br>ctx.GetObject("testService") as ISayHello = null ??<br>ctx.GetObject("testService") as TestService 都会报错<br><br>请不吝赐教！</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("莫耶",1730354,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1730354,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%8e%ab%e8%80%b6" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl04_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl04$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl04_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1730354">#5楼</a><a name="1730354" id="comment_anchor_1730354"></a>2009-12-22 10:50 | <a id="Comments1_CommentList_ctl04_NameLink" href="http://www.cnblogs.com/moye/" target="_top">莫耶</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%8e%ab%e8%80%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1730354" class="blog_comment_body"><a href="#1729874" title="查看所回复的评论">@</a>WideWeide<br>其一，看看你的Config是怎么装配的<br>是用的ObjectNameAutoProxyCreator还SdkRegularExpressionMethodPointcut？<br>前者他配的是&lt;value&gt;*Service&lt;/value&gt;<br>那么testService符合条件<br>后者的话 被拦截的方法是什么？<br><br>其二，使用接口和IOC<br>&lt;object id="testService" type="ConfigRegular.TestService,ConfigRegular"/&gt;<br>在调用类中，声明字段<br>public ISayHello testService;<br>这个调用(假设名为useClass)类，在配置中声明：<br>&lt;object id="useClass" type="userLayer.useClass,userLayer" autowire="byName" /&gt;<br>在useClass中，testService的生命周期，将被spring.net托管,使用时无需实例化：<br>testService.SayHello();</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("WideWeide",1730440,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1730440,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=WideWeide" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl05_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl05$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl05_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1730440">#6楼</a><a name="1730440" id="comment_anchor_1730440"></a>2009-12-22 12:21 | <a id="Comments1_CommentList_ctl05_NameLink" href="http://www.cnblogs.com/WideWeide/" target="_top">WideWeide</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/WideWeide" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1730440" class="blog_comment_body">谢谢回复！<br><br>首先再次说明一下讨论的前提：我是基于楼主这篇文章代码下载SpringNet_Lesson15.rar中的项目：<b>ConfigRegular</b>，如方便请下载并查看<br><br>其一，我的配置文件是这样的（摘录）<br><br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>   &lt;property name="pattern" value="Service.*.Find*"/&gt;<br>&lt;/object&gt;<br>-------<br>我的理解是拦截Service命名空间下的方法名称以Find开头的方法，但直接结果是：<br>================================<br>categoryService 拦截：<br>开始:  ProductService.FindAll<br>结束:  ProductService.FindAll<br><br>保存：数据<br><br>testService 拦截：<br>开始:  TestService.FindAll<br>结束:  TestService.FindAll<br><br>保存：数据<br><br>productService 拦截：<br>开始:  ProductService.FindAll<br>结束:  ProductService.FindAll<br><br>保存：数据<br>==================================<br><br>尝试改为：<br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>        &lt;property name="pattern" value="TestService.FindAll"/&gt;<br>      &lt;/object&gt;<br><br>或<br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>        &lt;property name="pattern" value="Service.CategoryService.*"/&gt;<br>      &lt;/object&gt;<br>结果是什么都没有拦截到……，这让我感到很困惑到底SdkRegularExpressionMethodPointcut的拦截模式到底是对完整命名空间进行拦截，对方法名进行拦截？其模式用通配符还是需要正则表达式？我查阅了spring.net的文档，没有看到具体如何编写。也简单看了源代码，水平有限，也没分析出来……</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("WideWeide",1730458,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1730458,"Kar3XTBBXTHUapYwvM3/0ufOR2IX3HcASNyd592FaI3wC12W1pvt3A==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=WideWeide" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl06_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl06$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl06_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1730458">#7楼</a><a name="1730458" id="comment_anchor_1730458"></a>2009-12-22 12:40 | <a id="Comments1_CommentList_ctl06_NameLink" href="http://www.cnblogs.com/WideWeide/" target="_top">WideWeide</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/WideWeide" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1730458" class="blog_comment_body">其二：您所提的useClass调用testService的方法我明白，实际中也是这么用的。useClass通常是Spring.Web.UI.Page(目前只确认这个)可供远程调用<br><br>我提的问题比较具体：没有useClass,我是想在class Program.Main方法中调用，尝试了代码：<br>var iSay = (ISayHello)ctx.GetObject("testService");<br>if (iSay != null) iSay.SayHello();<br><br>经过验证发现，设置为：<br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>        &lt;property name="pattern" value="NONO"/&gt;<br>      &lt;/object&gt;<br>此时testService没有被代理，则上述代码能够成功执行。<br><br>如果设置为：<br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>        &lt;property name="pattern" value="Service.*"/&gt;<br>      &lt;/object&gt;<br>此时testService被代理，发生异常：<br>无法将类型为“CompositionAopProxy_ccc3e277a458445aa52db20abda65262”的对象强制转换为类型“ConfigRegular.ISayHello”。<br><br>---------------------<br>这个问题只是技术探讨，由于未开发控制台程序和WinForm程序，不知道会不会在实际项目中遇到。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("莫耶",1730605,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1730605,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%8e%ab%e8%80%b6" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl07_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl07$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl07_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1730605">#8楼</a><a name="1730605" id="comment_anchor_1730605"></a>2009-12-22 15:02 | <a id="Comments1_CommentList_ctl07_NameLink" href="http://www.cnblogs.com/moye/" target="_top">莫耶</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%8e%ab%e8%80%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1730605" class="blog_comment_body">@WideWeide<br>非常好的范例，我下载了lesson15 <br>观察到这样的代码：<br>namespace Service<br>{<br>    public interface IService<br>    {<br>        IList FindAll();<br>        void Save(object entity);<br>    }<br>}<br><br>为什么拦截认为FindAll不是一个testService的方法，而是一个Servce命名空间下的方法，就在于testService归根到底是以IService实现者身份在运行时被拦截的，导致这种身份的，是这样的调用代码：<br><br>IService service = (IService)entry.Value;<br>service.FindAll();<br><br>而 Find* 方法，在ConfigRegular命名空间下是不存在的，它来自于基类的空间，来自接口IService<br><br>在此例中，也许你想要拦截专属于TestService的方法，我的建议是：<br>TestService所在的命名空间应该拥有一个FindAll()接口声明，比如：<br>public interface ISayHello<br>{<br>        void SayHello();<br>        IList FindAll();<br>}<br>TestService去实现它，并覆盖掉基类的方法：<br>public class TestService : ProductService, ISayHello<br>{<br>        public void SayHello()<br>        {<br>            Console.WriteLine("Hello,你好，哈哈");<br>        }<br>        public new IList FindAll()<br>        {<br>            return new ArrayList();<br>        }<br>}<br>调用处，就不是以IService身份，而是ISayHello：<br>IDictionary speakerDictionary = ctx.GetObjectsOfType(typeof(ISayHello));<br>foreach (DictionaryEntry entry in speakerDictionary)<br>{<br>                string name = (string)entry.Key;<br>                ISayHello service = (ISayHello)entry.Value;<br>                Console.WriteLine(name + " 拦截： ");<br><br>                service.FindAll();<br>....<br>}<br>配置像这样：<br>&lt;object id="advisor" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"&gt;<br>        &lt;property name="pattern" value="ConfigRegular.*.Find*"/&gt;<br>&lt;/object&gt;<br><br>大致这样便可，不知我表述清楚了没有~</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("莫耶",1730632,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1730632,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%8e%ab%e8%80%b6" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl08_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl08$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl08_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1730632">#9楼</a><a name="1730632" id="comment_anchor_1730632"></a>2009-12-22 15:25 | <a id="Comments1_CommentList_ctl08_NameLink" href="http://www.cnblogs.com/moye/" target="_top">莫耶</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%8e%ab%e8%80%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1730632" class="blog_comment_body">我想在WideWeide提供的这个场景中，要想比较完美的拦截，莫过于派生类实现单独的接口<br>在advisor看来 所有对象都是Service空间内的 因为基类实现Service空间下的接口<br><br>&lt;property name="pattern" value="Service.*"/&gt;<br>和<br>&lt;property name="pattern" value="ConfigRegular.*"/&gt;<br>在拦截器看来 并无区别<br>只有特化需要拦截的派生类 是理想的方案</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("莫耶",1731282,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1731282,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Aop_Config.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%8e%ab%e8%80%b6" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl09_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl09$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl09_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1731282">#10楼</a><a name="1731282" id="comment_anchor_1731282"></a><a name="Post"></a>2009-12-23 10:35 | <a id="Comments1_CommentList_ctl09_NameLink" href="http://www.cnblogs.com/moye/" target="_top">莫耶</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%8e%ab%e8%80%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1731282" class="blog_comment_body">@WideWeide<br>我想我找到问题出在哪了！<br><br>不是类层次关系问题 而是正则表达式捕获<br>我试着将<br>　　TestService更名为TestMinistry<br>　　SayHelloService更名为SayHelloMinistry<br>配置中同步为：<br>　　&lt;object id="testMinistry" type="ConfigRegular.TestMinistry,ConfigRegular"/&gt;<br>&lt;object id="SayHelloMinistry" type="ConfigRegular.SayHelloMinistry,ConfigRegular"/&gt;<br><br>在捕获&lt;property name="pattern" value="Service.*"/&gt;时<br>结果为：<br><br><a href="http://pic002.cnblogs.com/img/moye/200912/2009122310331352.jpg" target="_top"><img src="2009122310331352.jpg" border="0"></a><br>________________________________________<br>虚惊一场<br></span><br>
			</div>
		</div>
	

<div id="ctl05_comment_form" class="commentform">




<div id="ctl05_divLoginPannel">
<div class="login_tips">注册用户登录后才能发表评论，请 <a href="http://passport.cnblogs.com/login.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fGoodHelper%2farchive%2f2009%2f11%2f16%2fSpringNet_Aop_Config.html%3flogin%3d1%23commentform" class="underline">登录</a> 或 <a href="http://passport.cnblogs.com/register.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fGoodHelper%2farchive%2f2009%2f11%2f16%2fSpringNet_Aop_Config.html%23Bottom2" class="underline">注册</a> 。</div>
</div>

<div class="itnews c_ad_block" id="itnews">
<a href="http://news.cnblogs.com/" target="_top">IT新闻</a>:<br>

          ·  <a href="http://news.cnblogs.com/n/55140/" target="_top">《星际争霸2》"刀锋女王"重金属主题音乐视频</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55139/" target="_top">中国站长最郁闷的几件事情</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55138/" target="_top">苹果Vs谷歌：手机领域谁怕谁？</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55137/" target="_top">摩托罗拉：豪赌Android的希望与隐忧</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55136/" target="_top">分众新坐标：楼宇是过去 未来在手机和互联网</a><br>
	
</div>


<div id="ad_under_comment" class="c_ad_block">
<a href="http://a4.yeshj.com/rd/34138/" target="_top">每天10分钟，轻松学英语</a><br><br>
<div id="google_ads_div_cnblogs_blogpost_bottom1">
<iframe src="index_2.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom1" id="google_ads_iframe_cnblogs_blogpost_bottom1" scrolling="no" frameborder="0" height="60" width="468"></iframe></div>

<br>
<div id="google_ads_div_cnblogs_blogpost_bottom">
<iframe src="index_3.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom" id="google_ads_iframe_cnblogs_blogpost_bottom" scrolling="no" frameborder="0" height="250" width="300"></iframe></div>

</div>
<div id="site_nav_under" class="c_ad_block">
网站导航：<br>
<a href="http://www.cnblogs.com/" target="_top">博客园首页</a> &nbsp;<a href="http://news.cnblogs.com/" target="_top">IT新闻</a> &nbsp;<a href="http://home.cnblogs.com/" target="_top">个人主页</a> &nbsp;<a href="http://home.cnblogs.com/ing/" target="_top">闪存</a> &nbsp;<a href="http://job.cnblogs.com/" target="_top">程序员招聘</a> &nbsp;<a href="http://space.cnblogs.com/" target="_top">社区</a> &nbsp;<a href="http://space.cnblogs.com/q/" target="_top">博问</a> &nbsp;<a href="http://wz.cnblogs.com/" target="_top">网摘</a>
</div>
<div id="ad_under_comment2" class="c_ad_block">
<a href="http://www.china-pub.com/STATIC07/0912/zh_ndcx_091212.asp" target="_top"><img src="chinapub_20091222.jpg" alt="" style="border: 0px none ;"></a><br>
<a href="http://www.china-pub.com/itbook/" target="_top">China-pub 计算机图书网上专卖店！6.5万品种2-8折！</a><br>
<a href="http://www.china-pub.com/static07/0901/zh_jueba_090121.asp" target="_top">China-Pub 计算机绝版图书按需印刷服务</a><br>
</div>

<div id="relative_search"><br><b>相关搜索:</b><br> <a href="http://zzk.cnblogs.com/s?w=Spring.NET" target="_top">Spring.NET</a> <a href="http://zzk.cnblogs.com/s?w=AOP" target="_top">AOP</a> <a href="http://zzk.cnblogs.com/s?w=Spring.NET" target="_top">Spring.NET</a> </div><div id="relative_search"><br><b>在知识库中查看：</b><br> <a href="http://kb.cnblogs.com/a/1603591/">Spring.NET学习笔记15——AOP的配置(基础篇) Level 200</a></div>

</div>


				
	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<!--done-->
<div class="newsItem">
<h3 class="catListTitle">公告</h3>
	<div id="profile_block"><a href="http://home.cnblogs.com/GoodHelper/" target="_top">我的主页</a>&nbsp; <a href="http://home.cnblogs.com/GoodHelper/detail/" target="_top">个人资料</a><br><a href="http://home.cnblogs.com/GoodHelper/ing/" target="_top">我的闪存</a>&nbsp; <a href="http://space.cnblogs.com/msg/send/%e5%88%98%e5%86%ac.NET" target="_top">发短消息</a></div>
</div>

			
<div id="calendar">
<table id="Calendar1_entryCal" class="Cal" title="Calendar" border="0" cellpadding="0" cellspacing="0">
	<tbody><tr><td colspan="7"><table class="CalTitle" border="0" cellspacing="0">
		<tbody><tr><td class="CalNextPrev"><a href="javascript:__doPostBack('Calendar1$entryCal','V3622')" style="color: Black;" title="Go to the previous month">&lt;</a></td><td align="center">2010年1月</td><td class="CalNextPrev" align="right"><a href="javascript:__doPostBack('Calendar1$entryCal','V3684')" style="color: Black;" title="Go to the next month">&gt;</a></td></tr>
	</tbody></table></td></tr><tr><th class="CalDayHeader" abbr="日" scope="col" align="center">日</th><th class="CalDayHeader" abbr="一" scope="col" align="center">一</th><th class="CalDayHeader" abbr="二" scope="col" align="center">二</th><th class="CalDayHeader" abbr="三" scope="col" align="center">三</th><th class="CalDayHeader" abbr="四" scope="col" align="center">四</th><th class="CalDayHeader" abbr="五" scope="col" align="center">五</th><th class="CalDayHeader" abbr="六" scope="col" align="center">六</th></tr><tr><td class="CalOtherMonthDay" align="center">27</td><td class="CalOtherMonthDay" align="center">28</td><td class="CalOtherMonthDay" align="center">29</td><td class="CalOtherMonthDay" align="center">30</td><td class="CalOtherMonthDay" align="center">31</td><td align="center">1</td><td class="CalWeekendDay" align="center">2</td></tr><tr><td class="CalWeekendDay" align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td class="CalWeekendDay" align="center">9</td></tr><tr><td class="CalWeekendDay" align="center">10</td><td align="center">11</td><td align="center">12</td><td align="center">13</td><td align="center">14</td><td align="center">15</td><td class="CalWeekendDay" align="center">16</td></tr><tr><td class="CalTodayDay" align="center">17</td><td align="center">18</td><td align="center">19</td><td align="center">20</td><td align="center">21</td><td align="center">22</td><td class="CalWeekendDay" align="center">23</td></tr><tr><td class="CalWeekendDay" align="center">24</td><td align="center">25</td><td align="center">26</td><td align="center">27</td><td align="center">28</td><td align="center">29</td><td class="CalWeekendDay" align="center">30</td></tr><tr><td class="CalWeekendDay" align="center">31</td><td class="CalOtherMonthDay" align="center">1</td><td class="CalOtherMonthDay" align="center">2</td><td class="CalOtherMonthDay" align="center">3</td><td class="CalOtherMonthDay" align="center">4</td><td class="CalOtherMonthDay" align="center">5</td><td class="CalOtherMonthDay" align="center">6</td></tr>
</tbody></table>
</div>

			
			<div id="leftcontentcontainer">
				

<div class="mySearch">
<h3 class="catListTitle">搜索</h3>
<div class="div_my_zzk"><input value="" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk" type="text">&nbsp;<input onclick="zzk_go()" value="找找看" id="btnZzk" class="btn_my_zzk" type="button"></div>
</div>
<div class="catListLink">
<h3 class="catListTitle">常用链接</h3>
<ul>

		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl00_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyPosts.html">我的随笔</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl01_lnkLinkItem" href="http://home.cnblogs.com/GoodHelper/">我的空间</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl02_lnkLinkItem" href="http://space.cnblogs.com/msg/recent">我的短信</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyComments.html">我的评论</a></li>
	
<li><a id="itemListLink" onclick="this.blur();WarpClass('itemListLink', 'itemListLin_con');return false;" href="#">更多链接</a></li>
</ul>
<div id="itemListLin_con" style="display: none;">
<ul>

		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl00_lnkLinkItem" title="我发表过评论的随笔" href="http://www.cnblogs.com/GoodHelper/OtherPosts.html">我的参与</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl01_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyNews.html">我的新闻</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl02_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/RecentComments.html">最新评论</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/tag/">我的标签</a></li>
	
</ul>
</div>
</div>

<div class="catListTag">
<h3 class="catListTitle">我的标签</h3>
<ul>
<li><a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/">Spring.NET</a>(30)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/">NHibernate</a>(7)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/">AOP</a>(7)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/IoC/">IoC</a>(5)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/%e4%be%9d%e8%b5%96%e6%b3%a8%e5%85%a5/">依赖注入</a>(4)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/NVelocity/">NVelocity</a>(4)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/WCF/">WCF</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/ASP.NET+MVC/">ASP.NET MVC</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/Linq/">Linq</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/DI/">DI</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/">更多</a></li>
</ul>
</div>
<div class="catListPostCategory">
<h3 class="catListTitle">随笔分类<span style="font-size: 11px; font-weight: normal;">(36)</span></h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/category/214139.html">NHibernate(7)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_RssLink" title="Subscribe to NHibernate(7)" href="http://www.cnblogs.com/GoodHelper/category/214139.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" href="http://www.cnblogs.com/GoodHelper/category/215413.html">Spring.NET(29)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_RssLink" title="Subscribe to Spring.NET(29)" href="http://www.cnblogs.com/GoodHelper/category/215413.html/rss">(rss)</a></li>

</ul>

</div>

<div class="catListPostArchive">
<h3 class="catListTitle">随笔档案<span style="font-size: 11px; font-weight: normal;">(28)</span></h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/archive/2009/11.html">2009年11月 (20)</a> </li>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl02_Link" href="http://www.cnblogs.com/GoodHelper/archive/2009/10.html">2009年10月 (8)</a> </li>

</ul>

</div>

<div class="catListArticleCategory">
<h3 class="catListTitle">文章分类</h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/category/214956.html">Spring.NET</a> <a id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_RssLink" title="Subscribe to Spring.NET" href="http://www.cnblogs.com/GoodHelper/category/214956.html/rss">(rss)</a></li>

</ul>

</div>

<div class="catListImageCategory">
<h3 class="catListTitle">相册</h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl03_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/gallery/219559.html">广州宿舍</a> </li>

</ul>

</div>



<div class="catListBlogRank">
<h3 class="catListTitle">积分与排名</h3>
<ul>
	<li class="liScore">
		积分 -	51075
	</li><li class="liRank">
		排名 -	1473
	</li>
</ul>
</div>



<div class="catListEssay">
<h3 class="catListTitle">最新随笔</h3>
<ul>
	
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl00_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/21/SpringNet_blogs.html">1.&nbsp;Spring.NET学习笔记——前言</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_NVelocity.html">2.&nbsp;Spring.NET学习笔记26——整合NVelocity(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_Index.html">3.&nbsp;Spring.NET学习笔记——目录(原)</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_QuartzNet.html">4.&nbsp;Spring.NET学习笔记25——整合Quartz.NET(应用篇) Level 200</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_WebService.html">5.&nbsp;Spring.NET学习笔记21——整合Web Service(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Remoting.html">6.&nbsp;Spring.NET学习笔记20——整合Remoting(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html">7.&nbsp;Spring.NET学习笔记19——整合NHibernate和ASP.NET MVC(基础篇) Level 300</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl03_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html">8.&nbsp;Spring.NET学习笔记18——整合NHibernate(基础篇) Level 300</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl04_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/17/SpringNet_Transaction_Required.html">9.&nbsp;Spring.NET学习笔记17——事务传播行为(基础篇) Level 200</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl05_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html">10.&nbsp;Spring.NET学习笔记16——事务管理(应用篇) Level 200</a></li>
		
		
</ul>
</div>

<div class="catListComment">
<h3 class="catListTitle">最新评论<a id="SingleColumn1__1c5f994_RSSHyperlink1" title="RSS订阅最最新评论" href="http://www.cnblogs.com/GoodHelper/CommentsRSS.aspx"><img title="RSS订阅最最新评论" src="xml.gif" style="border-width: 0px;"></a></h3>

	
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl00_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html#1746723">1.&nbsp;Re:Spring.NET学习笔记16——事务管理(应用篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				这么好的文章为啥没人评论呢？
一直看楼主的这一系列文章，写的很好，对我有很大帮助。
再次感谢楼主，希望能多出好文章。 (轻风随风)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl01_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html#1746697">2.&nbsp;Re:Spring.NET学习笔记19——整合NHibernate和ASP.NET MVC(基础篇) Level 300</a>
			</div>
			<div class="divRecentComment">
				今天带给大家的就是期待以久的ASP.NET MVC与Spring.NET和NHibernate的组合，视图打造.NET版的SSH(Spring-Struts-Hibernate)

很好很强大！ (shmilgmy)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl02_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/21/SpringNet_blogs.html#1746691">3.&nbsp;Re:Spring.NET学习笔记——前言</a>
			</div>
			<div class="divRecentComment">
				支持！期待lz王者归来:) (shmilgmy)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl03_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/11/SpringNet_Life.html#1741365">4.&nbsp;Re:Spring.NET学习笔记11——自定义对象行为(基础篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				有点迷糊了，第二部分没看明白。
莫非只是“配置”上的继承，仅是为了简化配置的编写？ (鹤冲天)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl04_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/11/SpringNet_Method.html#1741362">5.&nbsp;Re:Spring.NET学习笔记10——方法的注入(基础篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				不可思议，没想到.Net也能这样用！ (鹤冲天)
			</div>		
		
</div>

<div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/10/SpringNET_Framework_Step1.html">1.&nbsp;Spring.NET企业架构实践之 JQuery +  FlexiGrid + ASP.NET MVC + NVelocity + WCF + LINQ + NHibernate 综合应用(4064)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/Spring_NET_IoC.html">2.&nbsp;Spring.NET学习笔记1——控制反转(基础篇) Level 200(3088)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/16/linq2nhibernate.html">3.&nbsp;10分钟搞定Linq to NHibernate(一)——环境篇(2869)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Config.html">4.&nbsp;Spring.NET学习笔记2——环境搭建(基础篇) Level 200(2468)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Create.html">5.&nbsp;Spring.NET学习笔记4——对象的创建(基础篇) Level 200(1948)</a>
			</li>
		
			</ul>
		
</div>

<div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/10/SpringNET_Framework_Step1.html">1.&nbsp;Spring.NET企业架构实践之 JQuery +  FlexiGrid + ASP.NET MVC + NVelocity + WCF + LINQ + NHibernate 综合应用(29)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/16/linq2nhibernate.html">2.&nbsp;10分钟搞定Linq to NHibernate(一)——环境篇(28)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/Spring_NET_IoC.html">3.&nbsp;Spring.NET学习笔记1——控制反转(基础篇) Level 200(22)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Create.html">4.&nbsp;Spring.NET学习笔记4——对象的创建(基础篇) Level 200(19)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/26/SpringNET_DI.html">5.&nbsp;Spring.NET学习笔记6——依赖注入(应用篇) Level 300(17)</a>
			</li>
		
			</ul>
		
</div>

			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		
<!--done-->
Copyright ©2010 刘冬.NET
	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 --><a href="http://www.cnzz.com/stat/website.php?web_id=1738003" target="_top" title="站长统计"><img src="pic1.gif" border="0" hspace="0" vspace="0"></a><img src="stat.htm" border="0" height="0" width="0">

    </form>
	
	
      
    
    
    
</body>
</html>
